﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Utilities
{
    public class GraphPin
    {
        public GraphElement Element { get; protected set; }
        public string Name { get; set; }

        public List<GraphPin> IncomingLinks { get; set; }
        public List<GraphPin> OutgoingLinks { get; set; }

        public GraphPin(GraphElement element, string name)
        {
            Element = element;
            Name = name;

            IncomingLinks = new List<GraphPin>();
            OutgoingLinks = new List<GraphPin>();
        }

        public override string ToString()
        {
            return Name + " (" + (IncomingLinks.Count + OutgoingLinks.Count) + " links)";
        }
    }

    public class GraphPin<T>
    {
        public GraphElement<T> Element { get; protected set; }
        public string Name { get; set; }

        public List<GraphPin<T>> IncomingLinks { get; set; }
        public List<GraphPin<T>> OutgoingLinks { get; set; }

        public GraphPin(GraphElement<T> element, string name)
        {
            Element = element;
            Name = name;

            IncomingLinks = new List<GraphPin<T>>();
            OutgoingLinks = new List<GraphPin<T>>();
        }

        public override string ToString()
        {
            return Element.Name + ":" + Name + " (" + (IncomingLinks.Count + OutgoingLinks.Count) + " links)";
        }
    }
}
